Frequently Asked GLUT Questions

Here are few questions I expect to be frequently asked about GLUT 3.0. First, here are tag-line summaries of the question subject matter.

  1. Problems building GLUT.
  2. More GUI features.
  3. New with GLUT 3.0.
  4. GLUT for NT.
  5. GLUT for OS/2.
  6. GLUT for Power Mcintosh.
  7. GLUT 3.0 incompatibilities.
  8. GLUT and Motif.
  9. aux conversion to GLUT.
  10. SGI N32 and 64-bit support.
  11. FORTRAN and GLUT.
  12. Sophisticated input devices.
  13. GLUT and Open Inventor.
  14. GLUT, Sun, and Overlays.
  15. The GLUT stroke font.
  16. My upcoming book.
  17. GLUT and Microsoft portability.
  18. GLUT and networking.
  19. Asking GLUT questions.
  20. Free OpenGL.
  21. GLUT overlay example code.
  22. BadMatch errors running GLUT programs.
  23. New with GLUT 3.1.

Q1: I've tried to use the "mkmkfiles.imake" script to generate Makefiles so I can build GLUT, but it doesn't seem to work.

A1: While Imakefiles are supposted to be system independent (hence the "I"), the commands to translate Imakefiles into Makefiles varies from system to system. The X Consortium provides a command called "xmkmf", but vendors do not put this command in a consistent place. The "mkmkfiles.imake" script tries its best to generate Makefiles, but may get confused by different vendors configurations that I am not aware of.

It is also possible the imake configuration files (typically located at /usr/lib/X11/config) are buggy or from a very old version of X.

SGI users can benefit from using the "mkmkfile.sgi" script that uses SGI's parallel make, though "mkmkfiles.imake" should work too.


Q2: GLUT needs improved menus, dialog boxes, scrollbars, text entry fields, etc. to be useful to me?

A2: GLUT does not pretend to be a full-featured graphical user interface toolkit.

You _could_ write these sorts of GUI objects using GLUT and OpenGL if you needed to. The other alternative is to use Motif or whatever full featured toolkit you have.


Q3: What new things are in GLUT 3.0?

A3: See README.glut3 or read The OpenGL Utility (GLUT) Programming Interface document.


Q4: Is there a version of GLUT for Windows NT or Windows 95.

A4: Nate Robins and Layne Christensen at Evans & Sutherland has been working on a freely distributable version of GLUTfor Windows 95 and NT. His efforts are directed at porting GLUT 2.3; work on GLUT 3.0 is in progress.


Q5: Is there a version of GLUT for OS/2?

A5: Yes. I believe a version based on GLUT 2.x is distributed on an OS/2 OpenGL developer's CD-ROM.


Q6: Is there a version of GLUT for the Power Mcintosh?

A6: Was told by Template Graphics that an incomplete version of GLUT had been developed for their OpenGL product for the Power Mcintosh. I am not sure if it was ever completed or made available.


Q7: I'm hesitant about upgrading to GLUT 3.0 since I've got things working will with GLUT 2.3. Is the transition painful?

A7: I do not believe so. There are two changes worth noting that _may_ affect programs you have written.

First, you need a display callback registered before your display your windows on the screen. It did not make sense for this to not be true. In all likeihood, this should not affect your GLUT programs if they written well.

Second, you can no longer change, create, or destroy menus while pop-up menus are in use. Before, you could do this, but it meant a menu might be changed while in use. It was near impossible to describe what should happen in the case of menus being changed while in use that was likely to be portable to the way other window systems handled menus, so I made the practice illegal.

You can register a menu status callback to know when menus become used and unused to avoid changing menus while they are in use.

For more details about what has changed, see the CHANGES file.


Q8: So how do I use GLUT and Motif together?

A8: You don't. To make GLUT simple and easy-to-program, GLUT supplies its own event processing loop. This makes it nearly impossible to combine GLUT and Motif. If you want Motif, you probably want a full-featured toolkit, and you ship skip GLUT and implement your application directly in Motif.


Q9: I have a bunch of simpe OpenGL programs using the aux toolkit descibed in the OpenGL Programming Guide (the "red" book). Is there an easy way to convert them to GLUT?

A9: In the progs/redbook directory, there is a script named aux2glut.sed It will give you a good start at converting simple aux calls to their GLUT equivalents. It is a good start, but you'll still have to hand edit some things.

Here's a usage example:

sed -f aux2glut.sed < aux_prog. > glut_prog.c


Q10: I have IRIX 6.2 (or 6.1) and I'd like to write GLUT programs run in true 64-bit and/or benefit from the recent, faster MIPS processors. How do I build GLUT to support these newer application binary interfaces (ABIs)?

A10: See README.irix6


Q11: I'd like to write FORTRAN programs using GLUT and OpenGL. How do I use GLUT with FORTRAN?

A11: GLUT does have a FORTRAN language binding.

For instructions for building a binding library for Silicon Graphics workstations, see README.fortran


Q12: I'd like to use the sophisticated input devices that GLUT supports. What should I know about this?

A12: GLUT uses the X Input extension to talk to these devices. Because the X Input extension gives a framework for supporting input devices, but does not manadate how particular devices are supported, it is possible that each vendor supports the same input devices differently.

GLUT as implemented supports SGI's means of advertising the tablet, dial & button box, and Spaceball devices. I am not sure how other vendors support these devices. For the details of SGI's support for these devices, see README.xinput Since there is no benefit in each vendor supporting these same devices in a different an incompatible way, I encourage other vendors to implement their devices in this same manner.


Q13: Can I use GLUT and Open Inventor?

A13: Yes. See the README.inventor file. Also, some source code examples can be found at progs/inventor

Because the Open Inventor development enviornment is not supported on all systems, the Inventor example programs are not built by default, and the Makefile there only support SGI systems.


Q14: I have Sun workstation, and it is supposed to support overlays. So why does GLUT not use them?

A14: GLUT uses the SERVER_OVERLAY_VISUALS convention that advertises overlay visuals. Most major workstation vendors support this convention (DEC, HP, IBM, SGI), but Sun does not.


Q15: The stroke font used for GLUT looks familar. Where did it come from?

A15: The data for the "stroke roman" font is lifted from the X11R5 PEX sample implementation.


Q16: I read in the NOTICE file that you are writing a book on programming OpenGL for the X Window System. When will it be available?

A16: At SIGGRAPH '96 or possibly before that.


Q17: You mention an unnamed bu "very large window system software vendor" as the reason portable GLUT programs should not directly include <GL/gl.h> and <GL/glu.h> directly. What's the vendor and what are the details?

A17: Microsoft. It's version of <GL/gl.h> requires <windows.h> to be included before <GL/gl.h> can be included because of Microsoft function declaration conventions. Sigh.


Q18: I want my GLUT program to read and send information over a socket to some other program. How do I do this in in GLUT?

A18: You can not do it currently. I am considering such support for a possible GLUT 4.0. I'd like to have a portable solution.

What you'd like is a callback that would tell you when a socket is ready for reading and writing. I'm hoping to find a way to support this in an operating system independent manner. Does anyone know of a good portable interface for networked bytestream connections?

For now, you've got the source code to GLUT and you could hack it into GLUT for whatever particular interface your operating system provides.


Q19: Where's the best place to ask questions about GLUT or OpenGL? Can I just email them to you?

A19: While I may try to return email if I have time, the best place is the comp.graphics.api.opengl newsgroup. This gives a lot more people a chance to answer your question and you'll probably get an answer much faster than sending me email. Plus, I may not know the answer though someone on the "net" may know it.


Q20: My workstation doesn't have OpenGL. Where can I get a free copy to use with GLUT?

A20: OpenGL is licensed by Silicon Graphics and is not available as "free" or "public domain" software, but workstation vendors typically bundle OpenGL software with their workstation. However, there is a package called Mesa written by Brian Paul at the University of Wisconsin that implements the OpenGL API. (To be branded as "OpenGL", an implementation must be licensed and pass the Architectural Review Board's conformance suite, so Mesa is not an official "OpenGL" implementation.) Mesa does work with GLUT.


Q21: I hear GLUT 3.0 has overlay support. Where is an example?

A21: Look at progs/examples/zoomdino.c for an example of using overlays for rubber-banding and display of a help message, both in the overlays. Also, test/over_test.c exercises all of the overlay routines.


Q22: I get BadMatch X protocol errors when I run GLUT programs. What gives?

A22: There is a bug in the Solaris 2.4 and 2.5 implementation of XmuLookupStandardColormap. When you compile GLUT on Solaris 2.4 or 2.5, please apply the following patch and compile with -DSOLARIS_2_4_BUG to workaround the problem. See the comment in the patch below. This code is already in GLUT 3.1.

*** glut_win.c Wed Apr 24 14:06:08 1996
--- glut_win.c.bad     Wed Apr 24 14:03:58 1996
***************
*** 398,414 ****
    case TrueColor:
    case DirectColor:
      *colormap = NULL;   /* NULL if RGBA */
- #ifndef SOLARIS_2_4_BUG
-     /* Solaris 2.4 has a bug in its XmuLookupStandardColormap
-        implementation.  Please compile your Solaris 2.4 version 
-        of GLUT with -DSOLARIS_2_4_BUG to work around this bug.
-        The symptom of the bug is that programs will get a
-        BadMatch error from X_CreateWindow when creating a GLUT
-        window because Solaris 2.4 creates a  corrupted
-        RGB_DEFAULT_MAP property.  Note that this workaround
-        prevents Colormap sharing between applications, perhaps
-        leading unnecessary colormap installations or colormap
-        flashing. */
      status = XmuLookupStandardColormap(__glutDisplay,
        vi->screen, vi->visualid, vi->depth, XA_RGB_DEFAULT_MAP,
        /* replace */ False, /* retain */ True);
--- 398,403 ----
***************
*** 423,429 ****
              return;
            }
      }
- #endif
      /* If no standard colormap but TrueColor, just make a
         private one. */
      /* XXX Should do a better job of internal sharing for
--- 412,417 ----

Q23: What is new in GLUT 3.1?

A23: GLUT 3.1 is largely a maintence release. There are some new programs, a few minor GLUT library bug fixes, but mostly GLUT 3.1 is to make sure GLUT builds cleanly on various platforms like SunOS, HP/UX, Solaris, and Linux. See the CHANGES file included in the distribution for more details.


- Mark